<?php

namespace App\Services\Admin\SuperAdmin\User;

use App\Services\BaseService;

class BaseUserService extends BaseService
{
    /**
     * 通过角色ID获取 api路径 列表
     *
     * @param int $authorityId
     * @return array
     */
    public function getApisPathByAuthorityId(int $authorityId): array
    {
        $apiIds = $this->getAuthorityApisModel()->getApiIdListByAuthorityId($authorityId);
        if (empty($apiIds)) {
            return [];
        }

        $apis = $this->getApisModel()->getItemsByIds($apiIds, ['path']);
        if (!$apis) {
            return [];
        }

        return array_column($apis, 'path');
    }
}
